# Created with pycharm
# author:ju bai
# Date:2021/7/20
# Time:18:58
from selenium import webdriver
import time
# 系统工具包
import os
# 可输入弹窗

driver = webdriver.Chrome()
# 本地HTML
url = "file:///"+os.path.abspath("D:/Python/selenium2html/send .html")
driver.get(url)
driver.maximize_window()
time.sleep(3)

# 点击
driver.find_element_by_tag_name("input").click()
time.sleep(5)

# 首先获得alert的操作句柄
alert = driver.switch_to.alert
# 给文本框输入信息
alert.send_keys("哈哈哈")
# 关闭弹窗
alert.accept()

time.sleep(6)
driver.quit()